<link rel="stylesheet" href="<?php echo URL::base() ?>media/vendor/css/style.css" type="text/css" media="all" />
<script src="<?php echo URL::base() ?>media/js/jquery-1.10.1.min.js"></script>
<link rel="stylesheet" href="<?php echo URL::base() ?>media/vendor/artdialog/skins/default.css" type="text/css" media="all" />
<script src="<?php echo URL::base() ?>media/vendor/artdialog/jquery.artDialog.js"></script>
<link href="<?php echo URL::base() ?>media/vendor/css/ui-lightness/jquery-ui-1.10.4.custom.css" rel="stylesheet">
<script src="<?php echo URL::base() ?>media/vendor/js/jquery-1.10.2.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery-ui-1.10.4.custom.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery.ui.datepicker-zh-TW.js"></script>

<script type="text/javascript">
    $(document).ready(function(){
        $("#supplier_id").val('<?php echo isset($condtion['supplier_id'])?$condtion['supplier_id']:''?>');
        $("#supplier_name").val('<?php echo isset($condtion['supplier_name'])?$condtion['supplier_name']:''?>');
        $("#payways_id").val('<?php echo isset($condtion['payways_id'])?$condtion['payways_id']:0?>');
        $("#check_status").val('<?php echo isset($condtion['check_status'])?$condtion['check_status']:0?>');
        $("#coinid").val('<?php echo isset($condtion['coinid'])?$condtion['coinid']:0?>');
        /**
         * 修改付款方式
         */
        $(".change_active_status_btn_").click(
            function(){
                var pre = 'change_active_status_btn_';
                var num = $(this).attr('id').substr(pre.length);
                var id = $("#id_"+num).text();
                var payaccountinfo_id = $("#payaccountinfo_id_"+num).text();
                var active_status = $("#active_status_"+num).text();
                var active_status_next = 1;
                if(active_status == 1)
                {
                    active_status_next = 9;
                }
                var data = {'id':id,'payaccountinfo_id':payaccountinfo_id,'active_status':active_status_next};
                var re;
                $.ajax(
                    {
                        type:'post',
                        url:'<?php echo url::base(true)?>supplier/supplierbank/changestatus',
                        dataType:'json',
                        data:data,
                        async:false,
                        success:function(re_data)
                        {
                            re = re_data;
                        },
                        error:function()
                        {
                            var error = new Object;
                            error.code = '8';
                            error.msg = "系统出错，请联系IT";
                            re = error;
                        }
                    }
                );

                alert(re.msg);
                if(re.code == 1)
                {
                    location.reload();
                }
            }
        );


    })
</script>


<form>
    供应商ID:<input type="text" name="supplier_id" id="supplier_id">
    供应商名称:<input type="text" name="supplier_name" id="supplier_name">
    付款方式:
    <select name="payways_id" id="payways_id">
        <option value="0">全部</option>
        <?php if(isset($payway_all) and $payway_all){
            foreach($payway_all as $payway){?>
                <option value="<?php echo isset($payway['id'])?$payway['id']:'' ?>">
                    <?php echo isset($payway['paywayname'])?$payway['paywayname']:'' ?>
                </option>
        <?php }}?>
    </select>
    <!--激活状态:
    <select name="active_status">
        <option value="0">全部</option>
        <option value="1">激活</option>
        <option value="9">停用</option>
    </select>-->
    审核状态:
    <select name="check_status" id="check_status">
        <option value="0">全部</option>
        <option value="1">待审核</option>
        <option value="5">已通过</option>
        <option value="9">未通过</option>
    </select>
    币种:
    <select name="coinid" id="coinid">
        <option value="0">全部</option>
        <?php if(isset($coins_arr) and $coins_arr){
            foreach($coins_arr as $key=>$coin){?>
                <option value="<?php echo isset($key)?$key:'' ?>">
                    <?php echo isset($coin)?$coin:'' ?>
                </option>
            <?php }}?>
    </select>

    <!--开户银行:<input type="text" name="bankname">
    账户名称:<input type="text" name="bankaccountname">
    帐号:<input type="text" name="bankaccount">-->
    <input type="submit" name="supplierbanksearch" value="查询">
    <button type="reset">重置</button>
    <a href="<?php echo url::base(true)?>supplier/supplierbank/add" class="btn btn-info">添加</a>
</form>
<table class="table table-hover ">
    <tr>
        <th>
            供应商ID
        </th>

        <th>
            供应商名称
        </th>

        <th>
            付款方式
        </th>

        <th>
            开户银行
        </th>

        <th>
            帐号
        </th>

        <th>
            账户名称
        </th>
        <th>
           币种
        </th>

        <th>
            审核状态
        </th>

        <!--<th>
            状态
        </th>-->

        <th>
            修改
        </th>

        <th>
            详情
        </th>

    </tr>

    <?php
    if(isset($re_lists))
    {
    foreach($re_lists as $num=>$data){
    ?>
    <tr>
        <th>
            <?php
            echo isset($data['supplier_id'])?$data['supplier_id']:0;
            ?>
        </th>

        <th>
            <?php
            echo isset($data['supplier_name'])?$data['supplier_name']:'';
            ?>
        </th>

        <th>
            <?php
            echo isset($data['paywayname'])?$data['paywayname']:'';
            ?>
        </th>

        <th>
            <?php
            echo isset($data['bankname'])?$data['bankname']:'';
            ?>
        </th>

        <th>
            <?php
            echo isset($data['bankaccount'])?$data['bankaccount']:'';
            ?>
        </th>

        <th>
            <?php
            echo isset($data['bankaccountname'])?$data['bankaccountname']:'';
            ?>
        </th>

        <th>
            <?php
            echo isset($data['coins_name'])?$data['coins_name']:'';
            ?>
        </th>

        <th>
            <?php
            echo isset($data['check_status_string'])?$data['check_status_string']:'';
            ?>
        </th>

        <!--<th>
            <?php /*if(isset($data['check_status'])
            and $data['check_status'] == 5){*/?>
            <?php
/*            echo isset($data['active_status_string'])?$data['active_status_string']:'';
            */?>
            <div style="display: none">
            <span  id="id_<?php /*echo $num+1*/?>">
            <?php /*echo isset($data['id'])?$data['id']:0;*/?>
            </span>
            <span  id="payaccountinfo_id_<?php /*echo $num+1*/?>">
            <?php /*echo isset($data['payaccountinfo_id'])?$data['payaccountinfo_id']:0;*/?>
            </span>
            <span  id="active_status_<?php /*echo $num+1*/?>">
            <?php /*echo isset($data['active_status'])?$data['active_status']:9;*/?>
            </span>
            </div>
            <button id="change_active_status_btn_<?php /*echo $num+1*/?>" class="change_active_status_btn_">改变状态</button>
            <?php /*}*/?>
        </th>-->

        <th>
            <a href="<?php
            echo url::base(true).'supplier/supplierbank/edit?id='.(isset($data['id'])?$data['id']:0);?>">编辑</a>
        </th>

         <th>
            <a href="<?php
            echo url::base(true).'supplier/supplierbank/detail?id='.(isset($data['id'])?$data['id']:0);?>">详情</a>
        </th>
    </tr>


    <?php }?>

    <?php }?>
</table>
<div>
    <?php echo isset($pagination)?$pagination:NULL?>
</div>